package com.juyu.miliao.authentication.security;

import com.juyu.miliao.common.domain.CommonHead;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

public class UserNamePassWordRegisterToken extends UsernamePasswordAuthenticationToken {
    private static final long serialVersionUID = 2179298295179351888L;

    /**
     * 通用请求头
     */
    private CommonHead commonHead;

    public UserNamePassWordRegisterToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) {
        super(principal, credentials, authorities);
    }


    public UserNamePassWordRegisterToken(Object principal, Object credentials,CommonHead commonHead) {
        super(principal, credentials);
        if (commonHead == null) {
            throw new RuntimeException("commonHead can not be null");
        }
        this.commonHead = commonHead;
    }

    public CommonHead getCommonHead() {
        return commonHead;
    }
}
